package org.huzhp.audit.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.huzhp.audit.dao.RequestLogMapper;
import org.huzhp.audit.dao.UserLogMapper;
import org.huzhp.audit.entity.RequestLog;
import org.huzhp.audit.entity.UserLog;
import org.huzhp.audit.entity.vo.AuditLogVo;
import org.huzhp.audit.service.IAuditLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Description: java类作用描述
 * @Author: huzp
 * @CreateDate: 2020/4/10 10:36
 * @Version: 1.0
 */
@Service
public class AuditLogServiceImpl implements IAuditLogService {

    @Autowired
    private UserLogMapper userLogMapper;

    @Autowired
    private RequestLogMapper requestLogMapper;


    @Override
    public void saveUserLog(UserLog log) {
        userLogMapper.insert(log);
    }

    @Override
    public void saveRequestLog(RequestLog log) {
        requestLogMapper.insert(log);
    }

    @Override
    public Page pageAuditLog(AuditLogVo auditLogVo, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        return requestLogMapper.findAuditLog(auditLogVo);
    }
}
